package com.test.daily.leetcode.y2022.m07.day0716.v05;

/**
 * @descriptions:
 * @author: Tom
 * @date: 2022/7/16 下午 04:03
 * @version: 1.0
 */
public class Solution {
    public static class Node{
        Node left;
        Node right;
        int value;
        public Node(int value){
            this.value = value;
        }
    }
    public static class RecursiveTraverseBinaryTree{
        public void pre(Node head){
            System.out.print(head + " ");
            if(head.left != null){
                pre(head.left);
            }
            if(head.right != null){
                pre(head.right);
            }
        }
        public void in(Node head){
            if(head.left != null){
                in(head.left);
            }
            System.out.print(head.value + " ");
            if(head.right != null){
                in(head.right);
            }
        }
        public void post(Node head){
            if(head.left != null){
                post(head.left);
            }
            if(head.right != null){
                post(head.right);
            }
            System.out.print(head.value + " ");
        }
    }
}
